<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script src="/js/jquery-3.3.1.min.js"></script>

</head>
<body>

<P>th:if</P>
<div th:if="${cat!=null}">
    <p th:text="${cat.id}"></p>
    <p th:text="${cat.name}"></p>
<P>${}的两种方法</P>
    <p th:text="'cat 的id是：'+${cat.id}"></p>
    <p th:text="|cat 的id是：${cat.id}|"></p>

<p>switch</p>
    <dic th:switch="${cat.id}">
        <p th:case=" '2' "> case是1</p>
        <p th:case = "*">case是*</p>
    </dic>

    <P>@{}url的替换</P>
    <a href="index.html" th:href="@{/index(id=${cat.id})}">a标签</a>
<p>th:block </p>
    <th:block th:with="dd = ${cat}">
        <p th:if="${dd.id == 1}">cat.id = 1 </p>
    </th:block>

    <p>*{} </p>
    <th:block th:objcet="${cat}">
        <p th:text="*{firstName}"></p>
    </th:block>
</div>
<div th:if="${catList!=null}">
    <div th:each="c:${catList}">
        <th:block th:if="${c.id} eq 1">
            <span>block if</span>
        </th:block>
        <span th:text="${c.id}"></span>
    </div>

    <div th:each="c,lstat:${catList}">
        <span th:text="${lstat.index}"></span>
    </div>


</div>

 <input id="ajaxTest"/>
<script type="text/javascript">
    $(function(){
        $.ajax({
            url:"/cat/getCat",
            type:"post",
            dataType:"json",
            data:{
                id:"1"
            },

            async:false,
            success:function(data){
                $("#ajaxTest").val(data.name);
            }
        })
    })

</script>

</body>
</html>